@import '../core/theming/palette';
@import '../core/theming/theming';
@import '../core/theming/private';
@import '../core/typography/typography-utils';

$mat-tooltip-target-height: 22px;
$mat-tooltip-font-size: 10px;
$mat-tooltip-vertical-padding: ($mat-tooltip-target-height - $mat-tooltip-font-size) / 2;

$mat-tooltip-handset-target-height: 30px;
$mat-tooltip-handset-font-size: 14px;
$mat-tooltip-handset-vertical-padding:
    ($mat-tooltip-handset-target-height - $mat-tooltip-handset-font-size) / 2;

@mixin mat-tooltip-color($config-or-theme) {
  $config: mat-get-color-config($config-or-theme);
  $background: map-get($config, background);

  .mat-tooltip {
    background: mat-color($background, tooltip, 0.9);
  }
}

@mixin mat-tooltip-typography($config-or-theme) {
  $config: mat-get-typography-config($config-or-theme);
  .mat-tooltip {
    font-family: mat-font-family($config);
    font-size: $mat-tooltip-font-size;
    padding-top: $mat-tooltip-vertical-padding;
    padding-bottom: $mat-tooltip-vertical-padding;
  }

  .mat-tooltip-handset {
    font-size: $mat-tooltip-handset-font-size;
    padding-top: $mat-tooltip-handset-vertical-padding;
    padding-bottom: $mat-tooltip-handset-vertical-padding;
  }
}

@mixin _mat-tooltip-density($config-or-theme) {}

@mixin mat-tooltip-theme($theme-or-color-config) {
  $theme: mat-private-legacy-get-theme($theme-or-color-config);
  @include mat-private-check-duplicate-theme-styles($theme, 'mat-tooltip') {
    $color: mat-get-color-config($theme);
    $density: mat-get-density-config($theme);
    $typography: mat-get-typography-config($theme);

    @if $color != null {
      @include mat-tooltip-color($color);
    }
    @if $density != null {
      @include _mat-tooltip-density($density);
    }
    @if $typography != null {
      @include mat-tooltip-typography($typography);
    }
  }
}

